'use strict';

const BaseService = require('./base');
const modelName = 'Course';

class CourseService extends BaseService {
  constructor(ctx) {
    super(ctx, modelName);
  }

  pageOrder() {
    return [
      ['id', 'DESC']
    ];
  }

  listOrder() {
    return [
      ['id', 'DESC']
    ];
  }
  getPage(where, page, pageSize, order) {
    return this.ctx.model[this.modelName].findAndCountAll({
      where,
      offset: pageSize * (page - 1),
      limit: pageSize,
      order
    });
  }
}

module.exports = CourseService;
